fastlane_version '2.125.0'

before_all do
  # ensure_git_branch
  # ensure_git_status_clean
  # git_pull
end

platform :ios do
  desc 'Fetch certificates and provisioning profiles'
    lane :certificates do
      match(app_identifier: 'com.ReactNativeStarterKit.app', type: 'development', readonly: true)
      match(app_identifier: 'com.ReactNativeStarterKit.app', type: 'appstore', readonly: true)
    end

  desc 'Build the iOS application.'
    private_lane :build do
      # certificates
      # increment_build_number(xcodeproj: './ios/ReactNativeStarterKit.xcodeproj')
      gym(scheme: 'ReactNativeStarterKit', workspace: './ios/ReactNativeStarterKit.xcworkspace')
    end

  desc 'Ship to Testflight.'
    lane :beta do
      build
      pilot
      # commit_version_bump(message: 'Bump build', xcodeproj: './ios/ReactNativeStarterKit.xcodeproj')
      # push_to_git_remote
    end
end

platform :android do
  desc 'Build the Android application.'
    private_lane :build do
      gradle(task: 'clean', project_dir: 'android/')
      gradle(task: 'bundle', build_type: 'Release', project_dir: 'android/')
    end

  desc 'Ship to Playstore Beta.'
    lane :beta do
      build
      supply(track: 'beta', track_promote_to: 'beta')
      # git_commit(path: ['./android/gradle.properties'], message: 'Bump versionCode')
      # push_to_git_remote
    end
end
